import fetch from "node-fetch";

const regular = [
    /^(#|\/)?(h|H)(美图|all)$/,//all
    /^(#|\/)?(h|H)(手机|mp)$/,//mp
    /^(#|\/)?(h|H)(电脑|pc)$/,//pc
    /^(#|\/)?(h|H)1080$/,//1080p
    /^(#|\/)?(h|H)16$/,//setu
    /^(#|\/)?(h|H)(furry|fy)$/,//furry
    /^(#|\/)?(h|H)(动漫|st1)$/,
    /^(#|\/)?(h|H)(涩图|st2)$/,
    /^(#|\/)?(h|H)(涩图2|st3)$/,
    /^(#|\/)?(h|H)(涩图3|st4)$/,
    /^(#|\/)?(h|H)(快手|ks)$/,
    /^(#|\/)?(h|H)jk1$/,
    /^(#|\/)?(h|H)(黑丝|hs)$/,
    /^(#|\/)?(h|H)18$/,
    /^(#|\/)?(h|H)(诱惑|yh)$/,
    /^(#|\/)?(h|H)(白丝|bs)$/,
    /^(#|\/)?(h|H)(萝莉|loli)$/,
    /^(#|\/)?(h|H)(原神|ys)$/,
    /^(#|\/)?(h|H)(美腿|mt)$/,
    /^(#|\/)?(h|H)jk2$/,
    /^(#|\/)?(h|H)(cos|COS|Cos)$/,
    /^(#|\/)?(h|H)mc$/,
    /^(#|\/)?(h|H)mao$/,
]


export class example extends plugin {
    constructor() {
        super({
            name: '[Help小功能]随机美图',
            dsc: '来一张涩涩',
            event: 'message',
//改下优先级防止sbFanSky抢指令
            priority: -1145145,
            rule: [
                { reg: regular[0], fnc: 'mp' },
                { reg: regular[1], fnc: 'mp' },
                { reg: regular[2], fnc: 'pc' },
                { reg: regular[3], fnc: '1080' },
                { reg: regular[4], fnc: 'setu' },
                { reg: regular[5], fnc: 'furry' },
                { reg: regular[6], fnc: "st1" },
                { reg: regular[7], fnc: "st2" },
                { reg: regular[8], fnc: "st3" },
                { reg: regular[9], fnc: "st4" },
                { reg: regular[10], fnc: "ks" },
                { reg: regular[11], fnc: "jk1" },
                { reg: regular[12], fnc: "hs" },
                { reg: regular[13], fnc: "r18" },
                { reg: regular[14], fnc: "yh" },
                { reg: regular[15], fnc: "bs" },
                { reg: regular[16], fnc: "loli" },
                { reg: regular[17], fnc: "ys" },
                { reg: regular[18], fnc: "mt" },
                { reg: regular[19], fnc: "jk2" },
                { reg: regular[20], fnc: "cos" },
                { reg: regular[21], fnc: "mc" },
                { reg: regular[22], fnc: "mao" },
           ]
        });
    }

    async all(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=all";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }

    async mp(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=mp";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }

    async pc(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=pc";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }

    async 1080(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=1080";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }
    
    async setu(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=setu";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }

    async furry(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api?sort=furry";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

    }

    async st1(e) {
      await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
      let url = "https://image.anosu.top/pixiv/direct?r18=1&keyword=touhou";
      await e.reply(segment.image(url), false, { recallMsg: 30 });

    }    
  
    async st2(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "http://se.csnmb.com/API/ql.php";
        await e.reply(segment.image(url), false, { recallMsg: 30 });

    }    

    async st3(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://image.anosu.top/pixiv/direct?r18=1";
        await e.reply(segment.image(url), false, { recallMsg: 30 });

    }    

    async st4(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "http://se.csnmb.com/API/tu.php";
        await e.reply(segment.image(url), false, { recallMsg: 30 });

    } 

    async ks(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/ksxjj.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      } 

      async jk1(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "http://api.yujn.cn/api/jk.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      } 

      async jk2(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/jk.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      } 

      async hs(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/hs.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      } 

      async r18(e) {
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://moe.jitsu.top/api/?sort=r18&size=small&type=602";
        await e.reply(segment.image(url), false, { recallMsg: 30 });

    }    

      async yh(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "http://api.yujn.cn/api/yht.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      } 

      async bs(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "http://api.yujn.cn/api/baisi.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async loli(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.qtkj.love/api/yttp.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async ys(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/ys.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async mt(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/meitui.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async cos(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.qtkj.love/api/Cosplay.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async mc(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/mcapi.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }

      async mao(e) {    
        await e.reply('我给你翻翻去嗷...', false, { recallMsg: 5 });
        let url = "https://api.suyanw.cn/api/mao.php";
        await e.reply(segment.image(url), false, { recallMsg: 60 });

      }
}
